package com.dog.basics.admin.controller.mtkj;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dog.basics.bean.dto.admin.mtkj.OrderComplaintFromDto;
import com.dog.basics.bean.dto.admin.mtkj.OrderComplaintStatusDto;
import com.dog.basics.bean.vo.admin.mtkj.OrderComplaintVo;
import com.dog.basics.common.annotation.SysLog;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.mtkj.IMtOrderComplaintService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;

/**
 * <p>
 * 设备订单异常反馈异常反馈表 前端控制器
 * </p>
 *
 * @author wph
 * @since 2020-10-07
 */
@RestController
@RequestMapping("/pc/order/complaint")
@Api(value = "设备订单异常反馈模块", tags = "设备订单异常反馈模块")
@AllArgsConstructor
public class MtOrderComplaintController {
    private final IMtOrderComplaintService mtOrderComplaintService;

    /**
     * @Description: 设备订单异常反馈列表
     * @Param: DepositFromDto
     * @return: IPage<DepositVo>
     * @Author: wph
     * @Date:
     */

    @ApiOperation(value = "设备订单异常反馈列表", notes = "pc:mtOrderComplaint:page")
    @GetMapping("/page")
    @PreAuthorize("@pms.hasPermission('pc:mtOrderComplaint:page')")
    public R<IPage<OrderComplaintVo>> page(PageParam page, OrderComplaintFromDto obj) {
        IPage<OrderComplaintVo> list = mtOrderComplaintService.getPageList(page, obj);
        return R.ok(list);
    }


    /**
     * @Description: 删除设备订单异常反馈
     * @Param: ids
     * @return: Boolean
     * @Author: wph
     * @Date: 2020/05/19  0027
     */
    @SysLog("删除设备订单异常反馈")
    @ApiOperation(value = "删除设备订单异常反馈", notes = "pc:mtOrderComplaint:delete")
    @ApiImplicitParam(value = "设备订单异常反馈Id", name = "id", dataType = "Long", required = true)
    @DeleteMapping("/delete/{id}")
    @PreAuthorize("@pms.hasPermission('pc:mtOrderComplaint:delete')")
    public R<Boolean> delete(@PathVariable("id") Long id) {
        return R.ok(mtOrderComplaintService.deleteObj(id));
    }

    /**
     * @Description: 设备订单异常反馈处理
     * @Param: ids
     * @return: Boolean
     * @Author: wph
     * @Date: 2020/05/19  0027
     */
    @SysLog("设备订单异常反馈处理")
    @ApiOperation(value = "设备订单异常反馈处理", notes = "pc:mtOrderComplaint:feedback")
    @PreAuthorize("@pms.hasPermission('pc:mtOrderComplaint:feedback')")
    @PutMapping
    public R<Boolean> editFeedback(@RequestBody @Valid OrderComplaintStatusDto dto) {
        return R.ok(mtOrderComplaintService.editFeedback(dto));
    }

    /**
     * @Description: 确认退款
     * @Param: ids
     * @return: Boolean
     * @Author: wph
     * @Date: 2020/05/19  0027
     */
    @SysLog("确认退款")
    @ApiOperation(value = "确认退款", notes = "pc:mtOrderComplaint:return")
    @ApiImplicitParam(value = "设备订单异常反馈Id", name = "id", dataType = "Long", required = true)
    @PutMapping("/returnObj/{id}")
    @PreAuthorize("@pms.hasPermission('pc:mtOrderComplaint:return')")
    public R editOrderInfoFund(@PathVariable("id") Long id) {
        return R.ok(mtOrderComplaintService.pcReturnObj(id));
    }
}
